package com.itheima.dao.impl;

import com.alibaba.druid.pool.DruidDataSource;
import com.itheima.dao.BookDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

public class BookDaoImpl implements BookDao {

    @Autowired(required = true)
    //这个是对应的bean的id
    @Qualifier(value = "dataSource")
    public DruidDataSource dataSource;

    public void save() {
        System.out.println("book dao running...");
        System.out.println("============");
        System.out.println(dataSource.getUsername());
        System.out.println("============");
    }
}
